package defaultpackage;

import java.util.Vector;

public class VectorDemo {
	
	public static void main(String[] args) {
		
		Vector<Integer> v=new Vector<Integer>();
		v.add(1);
		v.add(2);
		System.out.println(v.size());
		for(int i=0;i<v.size();i++)
			System.out.println(v.get(i));
		//-----------------------------
		Vector<Car> v1=new Vector<Car>();
		Car c1=new Car();
		c1.setName("aaa");
		System.out.println(c1.getName());
		v1.add(c1);
		Car c2=new Car();
		c2.setName("bbb");
		v1.add(c2);
		for(Car c:v1)
			System.out.println(c.getName());
	}

}
      
 class Car{
	 private String name;
	 public void setName(String _name){
		 name=_name;
	 }
	 public String getName(){
		 return name;
	 }
 }
